package com.example.qiaoruian.shequ.view;

import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.qiaoruian.shequ.R;
import com.example.qiaoruian.shequ.WeatherActivity;
import com.example.qiaoruian.shequ.bean.TodayWeather;


/**
 * Created by qiaoruian on 2017/5/8.
 */

public class SettingWeatherItemView extends RelativeLayout {

    private TextView tv_wendu;
    private TextView tv_pm2_5;
    private TextView tv_airstate;
    private TextView tv_city;
    private TextView tv_weather;
    private RelativeLayout Rl_weather;
    private TodayWeather todayWeather;

    public SettingWeatherItemView(Context context) {
        super(context);
        initView(context);
    }

    public void setTodayWeather(TodayWeather todayWeather) {
        this.todayWeather = todayWeather;
    }

    public SettingWeatherItemView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        initView(context);
    }

    public SettingWeatherItemView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initView(context);

    }

    private void initView(final Context context) {
        // TODO Auto-generated method stub
        View.inflate(context, R.layout.setting_item_view, this);
        tv_wendu = (TextView) findViewById(R.id.tv_wendu);
        Rl_weather = (RelativeLayout) findViewById(R.id.Rl_weather);
        tv_pm2_5 = (TextView) findViewById(R.id.tv_pm2_5);
        tv_airstate = (TextView) findViewById(R.id.tv_airstate);
        tv_city = (TextView) findViewById(R.id.tv_city);
        tv_weather = (TextView) findViewById(R.id.tv_weather);
        Rl_weather.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(context, WeatherActivity.class);
                intent.putExtra("bean",todayWeather);
                context.startActivity(intent);
            }
        });
    }

    public TextView getTv_wendu() {
        return tv_wendu;
    }

    public TextView getTv_pm2_5() {
        return tv_pm2_5;
    }

    public TextView getTv_airstate() {
        return tv_airstate;
    }

    public TextView getTv_city() {
        return tv_city;
    }

    public TextView getTv_weather() {
        return tv_weather;
    }
}
